<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: #f4f4f4;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            margin: 0;
        }

        .container {
            background-color: #fff;
            border-radius: 5px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
            padding: 40px;
            width: 350px;
        }

        h2 {
            text-align: center;
            margin-bottom: 20px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        label {
            display: block;
            margin-bottom: 5px;
        }

        input[type="text"],
        input[type="password"],
        button[type="submit"] {
            width: 100%;
            padding: 15px;
            border: none;
            background: #eee;
            margin-bottom: 10px;
            box-sizing: border-box; /*  确保padding和border不会增加元素的总宽度 */
        }

        input[type="text"]:focus,
        input[type="password"]:focus {
            outline: none;
            background: #e8e8e8;
        }

        button[type="submit"] {
            background-color: #0d110d;
            color: white;
            cursor: pointer;
            opacity: 0.9;
        }

        button[type="submit"]:hover {
            opacity: 1;
        }

        .error {
            color: red;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
<div class="container">
    <h2>登录</h2>
    <form th:action="@{/login}" method="post">
        <div th:if="${param.error}" class="error">
            用户名或密码错误
        </div>
        <div class="form-group">
            <label for="username">用户名:</label>
            <input type="text" id="username" name="username" placeholder="请输入用户名">
        </div>
        <div class="form-group">
            <label for="password">密码:</label>
            <input type="password" id="password" name="password" placeholder="请输入密码">
        </div>
        <button type="submit">登录</button>
    </form>
</div>
</body>
</html>
